<template>
    <div class="gallery-container" @click.stop="handleClick">
        <div class="gallery-warrper">
            <swiper :options="swiperOption" class="swiper">
                <!-- slides -->
                <template v-for="item of imgs">
                    <swiper-slide :key="item.imgUrl" class="swiper-item">
                        <img :src="item.imgUrl" alt="">
                    </swiper-slide>
                </template>
                <!-- Optional controls -->
                <div class="swiper-pagination" slot="pagination"></div>
            </swiper>
        </div>
    </div>
</template>

<script>
  export default {
    name: 'Gallery',
    data () {
      return {
        // swiper参数配置
        swiperOption: {
          
          loop: true, //   循环轮播
          pagination: {
            el: '.swiper-pagination',
            type: 'fraction',
          },
        },
    
      }
    },
    props:{
      imgs: {
        type: Array,
        default(){
          return [
            {
            
            },
          ]
        }
      }
    },
    methods:{
      handleClick(){
        this.$emit('closeGallery')
      }
    }
  }
</script>

<style scoped lang="stylus">
    .gallery-container >>> .swiper-container {
        overflow inherit;
    }
    .gallery-container {
        // 图片画廊占满整个屏幕
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, .9);
        display: flex;
        flex-direction column;
        justify-content center;
        z-index: 6;
        .gallery-warrper {
            width: 100%;
            .swiper-container {
                img {
                    width: 100%;
                }
                .swiper-pagination {
                    color: #fff;
                    font-size:16px;
                    bottom: -1rem;
                }
            }
        }
    }
</style>